package br.ufc.creator;

import javax.swing.SwingUtilities;

import br.ufc.gui.AppFrame;

public class Application {
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			
			@Override
			public void run() {
				AppFrame frame = new AppFrame("Visual VM Creator");
				frame.setVisible(true);
			}
		});
	}
	
	public static void callVMBuilder(String hypervisor, String distro, String suite, String flavour, String arch) {
		try {
			String command = "gnome-terminal -e vmbuilder " + hypervisor + " " + distro + " --suite " + suite + " --flavour " + flavour + " --arch " + arch;
			final Process process = Runtime.getRuntime().exec(command);
			int returnCode = process.waitFor();
			System.out.println(command);
			System.out.println("Return Code: " + returnCode);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
